//
//  DLDealTC.m
//  delongzhitou
//
//  Created by Mr.Wang on 2018/12/19.
//  Copyright © 2018 delongzhitou. All rights reserved.
//

#import "DLDealTC.h"
#import "DLDealListModel.h"


@interface DLDealTC ()

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *statusLabel;

@property (nonatomic, strong) UILabel *moneyLabel;

@property (nonatomic, strong) UILabel *timeLabel;

@property (nonatomic, strong) UILabel *poundageLabel;

@end

@implementation DLDealTC



- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        [self layoutsubControls];
    }
    return self;
}

- (void) layoutsubControls {
    
    UILabel *titleLabel = [UILabel new];
    titleLabel.frame = CGRectMake(kAutoWidth(20), 8, kAutoWidth(115), 30);
    titleLabel.textColor = kDLNormalBlackColor;
    titleLabel.textAlignment =NSTextAlignmentLeft;
    titleLabel.font = kSystemFont(16);
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
//    titleLabel.backgroundColor = [UIColor redColor];
    
    UILabel *statusLabel = [UILabel new];
    statusLabel.frame = CGRectMake(titleLabel.right, titleLabel.top, kAutoWidth(100), titleLabel.height);
    statusLabel.textColor = kColorRGB(204, 204, 204);
    statusLabel.textAlignment =NSTextAlignmentCenter;
    statusLabel.font = kSystemFont(13);
    [self.contentView addSubview:statusLabel];
    self.statusLabel = statusLabel;
//    statusLabel.backgroundColor = [UIColor orangeColor];
    
    UILabel *moneyLabel = [UILabel new];
    moneyLabel.frame = CGRectMake(statusLabel.right, statusLabel.top, kScreenWidth - statusLabel.right - kAutoWidth(20), statusLabel.height);
    moneyLabel.textColor = kDLNormalBlackColor;
    moneyLabel.textAlignment =NSTextAlignmentRight;
    moneyLabel.font = kSystemFont(18);
    [self.contentView addSubview:moneyLabel];
    self.moneyLabel = moneyLabel;
//    moneyLabel.backgroundColor = [UIColor yellowColor];
    
    UILabel *timeLabel = [UILabel new];
    timeLabel.frame = CGRectMake(titleLabel.left, titleLabel.bottom + 8, statusLabel.right - kAutoWidth(20), 30);
    timeLabel.textColor = kColorRGB(204, 204, 204);
    timeLabel.textAlignment =NSTextAlignmentLeft;
    timeLabel.font = kSystemFont(13);
    [self.contentView addSubview:timeLabel];
    self.timeLabel = timeLabel;
//    timeLabel.backgroundColor = [UIColor greenColor];

    UILabel *poundageLabel = [UILabel new];
    poundageLabel.frame = CGRectMake(timeLabel.right, timeLabel.top, kScreenWidth - timeLabel.right - kAutoWidth(20), timeLabel.height);
    poundageLabel.textColor = kColorRGB(204, 204, 204);
    poundageLabel.textAlignment =NSTextAlignmentRight;
    poundageLabel.font = kSystemFont(13);
    [self.contentView addSubview:poundageLabel];
    self.poundageLabel = poundageLabel;
//    poundageLabel.backgroundColor = [UIColor blueColor];
    
}

- (void) setDealModel:(DLDealListModel *)dealModel {
    _dealModel = dealModel;
    
    self.titleLabel.text = [NSString stringWithFormat:@"%@", dealModel.portfolioName];
    
    self.statusLabel.text = [NSString stringWithFormat:@"%@", dealModel.status];
    
    self.moneyLabel.text = [NSString stringWithFormat:@"%.2f", dealModel.money.doubleValue];
    
    self.timeLabel.text = [NSString stringWithFormat:@"%@", dealModel.date];
    
    self.poundageLabel.text = [NSString stringWithFormat:@"%@", dealModel.commission];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
